package 多线程.AQS.countDownLathTest;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.concurrent.CountDownLatch;

@AllArgsConstructor
@NoArgsConstructor
public class Worker implements Runnable{
    private List<String> output;
    private CountDownLatch countDownLatch;
    @Override
    public void run() {
        synchronized (countDownLatch) {
            countDownLatch.countDown();
            // 获取剩余计数并添加到输出列表
            output.add("CountDown减一，剩余：" + countDownLatch.getCount());
        }

    }
}